DECLARE
V_COUNT       NUMBER;
V_SQL VARCHAR2(4000);

BEGIN

<#list sequenceList as s>
    SELECT COUNT(1) INTO V_COUNT FROM USER_SEQUENCES T WHERE T.SEQUENCE_NAME='${s.name}';
    IF V_COUNT > 1 THEN
    V_SQL := 'alter sequence ${s.name} '||
    <#if s.sequenceMinValue??&&s.sequenceMinValue != "">
        ' MINVALUE ${s.sequenceMinValue} '||
    </#if>
    <#if s.sequenceMaxValue??&&s.sequenceMaxValue != "">
        ' MAXVALUE ${s.sequenceMaxValue} '||
    </#if>
    <#if s.sequenceStartValue??&&s.sequenceStartValue != "">
        ' START WITH ${s.sequenceStartValue} '||
    </#if>
    <#if s.sequenceStep??&&s.sequenceStep != "">
        ' INCREMENT BY ${s.sequenceStep} '||
    </#if>
    <#if s.sequenceCacheSize??&&s.sequenceCacheSize != "">
        ' CACHE ${s.sequenceCacheSize} '||
    </#if>
    <#if s.getCycle()?string("true","false")=='true'>
        ' CYCLE '
    <#else >
        ' NOCYCLE '
    </#if>;
    EXECUTE IMMEDIATE V_SQL;
    DBMS_OUTPUT.PUT_LINE('{s.name} 序列修改成功');
    ELSE
    DBMS_OUTPUT.PUT_LINE('{s.name} 序列不存在');
    END IF;
</#list>

END;